import base64
from pathlib import Path


def image_to_base64(image_path: Path) -> str:
    """
    读取图片并转为 base64 字符串
    """
    with open(image_path, "rb") as img_file:
        return base64.b64encode(img_file.read()).decode("utf-8")
